// SkinStatic.cpp : implementation file
//

#include "stdafx.h"
#include "LoPlayer.h"
#include "SkinStatic.h"


// CSkinStatic

IMPLEMENT_DYNAMIC(CSkinStatic, CStatic)

CSkinStatic::CSkinStatic()
: m_sizeControl(70, 20)
{
	SetFont (_T("Arial"), 12, 0);
	SetFontColor(0);
}

CSkinStatic::~CSkinStatic()
{
}

CRect CSkinStatic::GetPlacement( const INT cxFrame, const INT cyFrame )
{
	CRect rt = CSkinControl::GetPlacement(cxFrame, cyFrame);
	rt.right = rt.left + m_sizeControl.cx;
	rt.bottom = rt.top + m_sizeControl.cy;

	return rt;
}


BOOL CSkinStatic::CreateInternal( const RECT& rect, CWnd* pParentWnd, UINT nID )
{
	if (!CStatic::Create(m_strCommandName, SS_OWNERDRAW | WS_VISIBLE, rect, pParentWnd, nID)) {
		return FALSE;
	}

	return TRUE;
}

BOOL CSkinStatic::LoadSkinImage( LPCTSTR lpszFilename )
{
	UNUSED(lpszFilename);

	return TRUE;
}

void CSkinStatic::DrawIt( Gdiplus::Bitmap* pbmWnd, const RECT& rect )
{
	ASSERT(pbmWnd);
	ASSERT(m_pFont);

	const int cxRect = (rect.right - rect.left);
	const int cyRect = rect.bottom - rect.top;
	SetWindowPos(NULL,
		rect.left - m_cxBorder,
		rect.top - m_cyBorder,
		cxRect,	cyRect,
		SWP_NOREDRAW);

	//  [6/15/2008 Dean]
	using namespace Gdiplus;
	Graphics graphic(pbmWnd);

	Color clText;
	clText.SetFromCOLORREF(m_clFnt);
	SolidBrush  solidBrush(clText);

	CString strCaption;
	GetWindowText (strCaption);
	graphic.SetTextRenderingHint(TextRenderingHintAntiAlias);
	graphic.DrawString(strCaption, -1, m_pFont, PointF(rect.left, rect.top), &solidBrush);
	// end test

}

void CSkinStatic::SetFont( LPCTSTR fontFamily, INT size, INT style )
{
	Gdiplus::Font fnt(fontFamily, (Gdiplus::REAL)size, style);
	m_pFont.Free();
	m_pFont.Attach(fnt.Clone());
}

void CSkinStatic::SetSize( INT cx, INT cy )
{
	m_sizeControl.SetSize(cx, cy);
}

BEGIN_MESSAGE_MAP(CSkinStatic, CStatic)
END_MESSAGE_MAP()



// CSkinStatic message handlers


